package com.yaoxuguang.concurrence.wait_notify.notify;

/**
 * @author yaoxuguang
 * @Title: yao-interview
 * @Package com.yaoxuguang.concurrence.wait_notify.notify
 * @Description: 线程等待方法-wait()
 * @date 2018年12月21日17:22
 */
public class ThreadWait extends Thread{
    private Object object;

    public ThreadWait(Object object) {
        this.object = object;
    }

    @Override
    public void run() {
        try {
            synchronized (object){
                System.out.println("wait方法开始....");
                object.wait();
                System.out.println("wait方法结束...");
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
